package com.kaifamiao.demo.d0805;

public class Demo04 {

    public static void main(String[] args) {
        // 并不是实例化了 抽象类 Pet， 有一个匿名类 继承了 抽象类 Pet
        Pet pet = new Pet() {

            int a = 1;
            static int b = 2;

            public void a(){}

            @Override
            public void eat() {
                a();
                System.out.println("eat()");
            }
        };

        int index = 1;
        new Pet() {
            static int a = 1;

            static {
                int a = 1;
            }

            @Override
            public void eat() {
                System.out.println(index);
                aaaa = 2;
                System.out.println("eat()");
            }

            public void a(){
                System.out.println("a");
            }
        }.a();

        pet.eat();
    }
}

class AA extends Pet {
    @Override
    public void eat() {
        System.out.println("eat()");
    }
}
